package com.baizhiedu.basic.mapper;

import com.baizhiedu.basic.pojo.Orders;
import com.baizhiedu.basic.pojo.Orders;
import com.baizhiedu.basic.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

/**
 * @Author: robert.song
 * @Date: Created in 2021/12/15
 */
@Mapper
public interface OrdersMapper {

    @Insert("insert into orders values(#{id},#{orderTime},#{total},#{uid})")
    public void save(Orders orders);

    @Update("update orders set total=#{total} where id =#{id}")
    public void update(Orders orders);

    @Delete("delete from orders where id=#{id}")
    public void delete(Integer id);

    @Select("select * from orders")
    @Results({
            @Result(column = "id", property = "id"),
            @Result(column = "order_time", property = "orderTime"),
            @Result(column = "total", property = "total"),
            @Result(column = "uid", property = "uid"),
    })
    public List<Orders> findAll();

    @Select("select * from orders where id =#{id}")
    public User findById(Integer id);
}
